<?php 
        require_once('include/JobSeeker.class.php'); 
        require_once('include/OurDatabase.class.php');
        include("include/session.php");
        
        $JS = new JobSeeker();
	
		$DB = new OurDatabase();
	
		$DB->open_connection();

        
        if($session->logged_in){
?>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="en-us" http-equiv="Content-Language" />
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Welcome</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
                <?php include('header.php');?>
                
                        <p class="auto-style2"><strong>Job Results</strong></p>

                        <table>
                               <?php					
									echo $JS->single_job($_POST['Job_ID']);
					
									$DB->close_connection();
								?>
                        </table>
                </div>
			
	<?
		$seekerid = $database->getSeekerId($session->username);
		if(!$seekerid){
			echo "No seeker id for session username";
		}
		else{
			$rows = $database->getUploadedFiles($seekerid);
			if(!$rows){
				echo "You have no uploaded files.";
			}
			else{
				echo "<form action=\"submitresume.php\" method=\"post\">";
				echo "Choose a file to submit: <select name=\"fileid\">";
				while($row=mysql_fetch_assoc($rows)){
					echo "<option value=\"".$row['id']."\">".$row['name']."</option>"; 
				}
				echo "</select>";
				echo "<input type=\"hidden\" name=\"jobid\" value=\"".$_POST['Job_ID']."\" />";
				echo "<input name=\"Button1\" type=\"submit\" value=\"Apply\" /></form>	";
			}
		}
	?>				
			
<?php }

else{
?>

<h1>Login</h1>
<?
/**
 * User not logged in, display the login form.
 * If user has already tried to login, but errors were
 * found, display the total number of errors.
 * If errors occurred, they will be displayed.
 */
if($form->num_errors > 0){
   echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
<font size="2">Remember me next time &nbsp;&nbsp;&nbsp;&nbsp;
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="lul/seeker/index.php">Sign-Up!</a></td></tr>
</table>
</form>

<?
}

/**
 * Just a little page footer, tells how many registered members
 * there are, how many users currently logged in and viewing site,
 * and how many guests viewing site. Active users are displayed,
 * with link to their user information.
 */
echo "</td></tr><tr><td align=\"center\"><br><br>";
echo "<b>Member Total:</b> ".$database->getNumMembers()."<br>";
echo "There are $database->num_active_users registered members and ";
echo "$database->num_active_guests guests viewing the site.<br><br>";

include("include/view_active.php");

?>
